package com.bainaeco.framework.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum BaseModelTableName {
	
	ID("id"),
	CREATED_TIME("created_time"),
	CREATED_BY("created_by"),
	UPDATED_TIME("updated_time"),
	UPDATED_BY("updated_by"),
	IS_DELETE("is_delete");
	
	private String name;

	private BaseModelTableName(String strategy) {
		this.name = strategy;
	}

	public String toStringValue() {
		return this.name;
	}

	public static BaseModelTableName toStatus(String name) {
		if (ID.name.equals(name)) {
			return ID;
		} else if(CREATED_TIME.equals(name)){
			return CREATED_TIME;
		} else if(CREATED_BY.equals(name)){
			return CREATED_BY;
		} else if(UPDATED_TIME.equals(name)){
			return UPDATED_TIME;
		} else if(UPDATED_BY.equals(name)){
			return UPDATED_BY;
		} else if(IS_DELETE.equals(name)){
			return IS_DELETE;
		} else {
			throw new InvalidArgumentException("Unknown name[" + name + "].");
		}
	}
}
